package com.demo.fruit;

public class FruitFactory {
    public static Fruit getFruit(String type,int num) {
        switch (type) {
            case "苹果":
                return new AppleFruit("苹果",num);
            case "芒果":
                return new MangoFruit("芒果",num);
            case "草莓":
                return new StrawberryFruit("草莓",num);
            default:
                return null;
        }
    }
}
